import { id } from "element-plus/es/locales.mjs"
import { toNamespacedPath } from "path"

//用户信息数据
let createUserList = {
    total: 132,
    data: [
        {
            creatTime: '2023-10-01 12:00:00',
            updateTime: '2023-10-01 12:00:00',
            logurl: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
            id: 1,
            tmName: '华为',
        },
        {
            creatTime: '2024-10-01 12:00:00',
            updateTime: '2024-10-01 12:00:00',
            logurl: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
            id: 20,
            tmName: '小米',
        }, {
            creatTime: '2023-09-01 12:00:00',
            updateTime: '2023-09-01 12:00:00',
            logurl: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
            id: 30,
            tmName: '苹果',
        },
        {
            creatTime: '2025-10-01 12:00:00',
            updateTime: '2025-10-01 12:00:00',
            logurl: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
            id: 40,
            tmName: '三星'
        },
    ]
}

export default [
    // 获取品牌信息
    {
        url: '/api/admin/product/baseTrademark',
        method: 'get',
        response: (request) => {
            //获取请求头携带token
            // const token = request.headers.token;
            //查看用户信息是否包含有次token用户
            // const checkUser = createUserList().find((item) => item.token === token)
            //没有返回失败的信息
            // if (!checkUser) {
            //     return { code: 201, data: { message: '获取用户信息失败' } }
            // }
            //如果有返回成功信息
            return { code: 200, ok: true, message: '', data: createUserList }
        },
    },

    {
        url: '/api/admin/product/baseTrademark/save',
        method: 'get',
        response: (request) => {
            //获取请求头携带token
            // const token = request.headers.token;
            //查看用户信息是否包含有次token用户
            // const checkUser = createUserList().find((item) => item.token === token)
            //没有返回失败的信息
            // if (!checkUser) {
            //     return { code: 201, data: { message: '获取用户信息失败' } }
            // }
            createUserList.data.push({
                creatTime: '2020-10-01 12:00:00',
                updateTime: '2020-10-01 12:00:00',
                logurl: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
                id: 50,
                tmName: 'OPPO',
            })
            //如果有返回成功信息
            return { code: 200, ok: true, message: '' }
        },
    },

    {
        url: '/admin/product/baseTrademark/update',
        method: 'post',
        response: (body) => {
            const { id } = body;
            //获取请求头携带token
            // const token = request.headers.token;
            //查看用户信息是否包含有次token用户
            // const checkUser = createUserList().find((item) => item.token === token)
            //没有返回失败的信息
            // if (!checkUser) {
            //     return { code: 201, data: { message: '获取用户信息失败' } }
            // }
            createUserList.data.forEach((item) => {
                if (item.id == id) {
                    item.tmName += '修改'
                }
            })
            //如果有返回成功信息
            return { code: 200, ok: true, message: '' }
        },
    },
]